#pragma once

#include <d3d11_1.h>
#include <directxmath.h>
#include "hrTimer.h"


#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.01745329251994329576923690768489

using namespace DirectX;

class Camera
{

private:
	float heading, pitch;

	XMMATRIX viewMatrix;
	XMMATRIX projectionMatrix;
	XMMATRIX rotationMatrix;

	const XMVECTOR dV, dU;
	XMVECTOR eye, view, up;

	XMVECTOR forward, strafeRight;
	int movementToggles[4];
	float movementSpeed;

	//camera timer for movement
	timer camTimer;

public:

	Camera();
	virtual ~Camera();

	void setPerspectiveProjectionLH(float FOV, float aspectRatio, float zNear, float zFar);

	//camera positioning methods
	void setPositionAndView(float x, float y, float z, float hDeg, float pDeg);
	void adjustHeadingPitch(float hRad, float pRad);
	void setMovementToggle(int i, int v);
	void setMovementSpeed(float s);

	//update camera view/position
	void update();

	XMMATRIX& getViewMatrix(){ return viewMatrix; }
	XMMATRIX& getProjectionMatrix(){ return projectionMatrix; }
	XMVECTOR& getCameraPosition(){ return eye; }

private:
	
	void updateView();

};

